<template>
<div class="box_one">
  <a-layout id="components-layout-demo-custom-trigger">
    <a-layout-sider v-model="collapsed" :trigger="null" collapsible>
      <div class="logo" />
      <a-menu theme="dark" mode="inline" :default-selected-keys="['1']">
        <a-menu-item key="1" @click="toAdaPage">
          <a-icon type="user" />
          <span>管理员模块</span>
        </a-menu-item>
        <a-menu-item key="2"  @click="toGoodsPage">
          <a-icon type="video-camera" />
          <span>商品模块</span>
        </a-menu-item>
        <a-menu-item key="3" @click="toOrderPage">
          <a-icon type="upload" />
          <span>订单模块</span>
        </a-menu-item>
        <a-menu-item key="4" @click="toLogPage">
          <a-icon type="upload" />
          <span>物流模块</span>
        </a-menu-item>
      </a-menu>
    </a-layout-sider>
    <a-layout>
      <a-layout-header style="background: #fff; padding: 0">
        <a-icon
          class="trigger"
          :type="collapsed ? 'menu-unfold' : 'menu-fold'"
          @click="() => (collapsed = !collapsed)"
        />
      </a-layout-header>
      <a-layout-content
        :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }"
      >
        <!-- Content -->
        <router-view />
      </a-layout-content>
    </a-layout>
  </a-layout>
  </div>
</template>
<script>
export default {
  data() {
    return {
      collapsed: false,
    };
  },
  methods:{
    toAdaPage:function(){
      console.log(1);
      this.$router.history.push('/toAdaPage');
    },
    toGoodsPage:function(){
      console.log(2);
      this.$router.history.push('/toGoodsPage');
    },
    toOrderPage:function(){
      console.log(3);
      this.$router.history.push('/toOrderPage');
    },
    toLogPage:function(){
      console.log(4);
      this.$router.history.push('/toLogPage');
    },
  }
};
</script>
<style>
#components-layout-demo-custom-trigger .trigger {
  font-size: 18px;
  line-height: 64px;
  padding: 0 24px;
  cursor: pointer;
  transition: color 0.3s;
}

#components-layout-demo-custom-trigger .trigger:hover {
  color: #1890ff;
}

#components-layout-demo-custom-trigger .logo {
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  margin: 16px;
}
.box_one{
  height: 100%;
}
.box_one #components-layout-demo-custom-trigger{
  height: 100%;
}
</style>
